/* GUI CONVERTED from rsscdel.p (converter v1.75) Sat Aug 12 23:15:59 2000 */
/* rsscdel.p - Release Management Supplier Schedules                    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=FullGUIReport                                 */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 7.3    LAST MODIFIED: 10/16/92           BY: WUG *G462*    */
/* REVISION: 7.3    LAST MODIFIED: 03/03/95           BY: aed *G0JC*    */
/* REVISION: 7.3    LAST MODIFIED: 06/23/95           BY: dxk *G0QY*    */
/* REVISION: 8.6    LAST MODIFIED: 03/17/97  BY: *K080* Kieu Nguyen     */


/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane     */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan    */
/* REVISION: 8.6E     LAST MODIFIED: 08/13/98   BY: *J2SN* Dana Tunstall */
/* REVISION: 9.1      LAST MODIFIED: 09/21/99   BY: *J3LL* Reetu Kapoor  */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb              */
     /* SHIPPER ARCHIVE/DELETE */


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

     {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rsscdel_p_1 "Delete"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsscdel_p_2 "Archive File"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsscdel_p_3 "Archive"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsscdel_p_4 "Confirmed Shippers"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsscdel_p_5 "Item Number"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsscdel_p_6 "ID"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsscdel_p_7 "Unconfirmed Shippers"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsscdel_p_8 "Supplier"
/* MaxLen: Comment: */

/*J3LL*/ /* CHANGED THE LABEL TO EFFECTIVE DATE FROM RECEIVE DATE */
&SCOPED-DEFINE rsscdel_p_9 "Effective Date"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsscdel_p_10 "Ship-To"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsscdel_p_11 "Ship-From Site"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */


          define variable shipfrom   like abs_shipfrom label {&rsscdel_p_8}.
          define variable shipfrom1  like abs_shipfrom label {t001.i}.
          define variable id         like abs_id.
          define variable id1        like abs_id       label {t001.i}.
/*J3LL**  define variable sdate      like abs_shp_date label {&rsscdel_p_9}. */
/*J3LL*/  define variable sdate      like abs_shp_date                no-undo.
          define variable sdate1     like abs_shp_date label {t001.i}.
/*J3LL*/  define variable l_effdate  like abs_eff_date label {&rsscdel_p_9}
/*J3LL*/                                                              no-undo.
/*J3LL*/  define variable l_effdate1 like abs_eff_date label {t001.i} no-undo.
       define variable sel_conf like mfc_logical  label {&rsscdel_p_4} init yes.
          define variable sel_unconf like mfc_logical  label {&rsscdel_p_7}.
     define variable filename as character format "x(12)" label {&rsscdel_p_2}.
/*K080*  define variable indent_id as character format "x(12)" label "ID". */
/*K080*/ define variable indent_id as character format "x(20)" label {&rsscdel_p_6}.
/*K080*  define variable disp_abs_id as character.  */
/*K080*/ define variable disp_abs_id as character format "x(20)".
     define new shared variable rdelete like mfc_logical label {&rsscdel_p_1}.
/*G0JC*/ define new shared variable archive like mfc_logical label {&rsscdel_p_3} init no.
         define new shared frame c.
         define new shared stream history.

         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
            
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
shipfrom    colon 20
/*K080*     shipfrom1   colon 40                         */
/*K080*     id          colon 20 format "x(12)"          */
/*K080*     id1         colon 40 format "x(12)"          */
/*K080*/    shipfrom1   colon 48
/*K080*/    id          colon 20
/*K080*/    id1         colon 48
            sdate       colon 20
/*K080*     sdate1      colon 40                         */
/*K080*/    sdate1      colon 48
/*J3LL*/    l_effdate   colon 20
/*J3LL*/    l_effdate1  colon 48
            skip(1)
            sel_conf    colon 30
            sel_unconf  colon 30
            skip(1)
            rdelete     colon 30
            archive     colon 30
            filename    colon 30
             SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



            /* SET EXTERNAL LABELS */
            setFrameLabels(frame a:handle).

        FORM /*GUI*/ 
           skip(1)
            abs_shipfrom    colon 28 label {&rsscdel_p_11}
/*K080*     abs_id          colon 28 label "ID" format "x(12)"    */
/*K080*/    abs_id          colon 28 label {&rsscdel_p_6} format "x(20)"
            ad_name         at 45 no-label
            ad_line1        at 45 no-label
            with STREAM-IO /*GUI*/  frame a1 side-labels width 80 attr-space.

            /* SET EXTERNAL LABELS */
            setFrameLabels(frame a1:handle).

        FORM /*GUI*/ 
           abs_shipto      colon 28 label {&rsscdel_p_10}
           si_desc         at 45 no-label
           with STREAM-IO /*GUI*/  frame b side-labels width 80 attr-space.

           /* SET EXTERNAL LABELS */
           setFrameLabels(frame b:handle).

        FORM /*GUI*/ 
/*K080*     indent_id    format "x(16)"       */
/*K080*/    indent_id    format "x(20)"
            abs_item     column-label {&rsscdel_p_5}
            scx_po       format "x(8)"
            scx_line
            abs_qty format "->,>>>,>>9.9<<<<<<<<"
            abs_site
            abs_loc
            abs_lotser
            abs_ref
            with STREAM-IO /*GUI*/  frame c down width 132 attr-space.

            /* SET EXTERNAL LABELS */
            setFrameLabels(frame c:handle).

        display
           sel_conf
           sel_unconf
           rdelete
/*G0JC*/   archive
           with frame a.

        
/*GUI mainloop removed */

        
/*GUI*/ {mfguirpa.i false  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

           output stream history close.

           if shipfrom1  = hi_char  then shipfrom1   = "".
           if id1        = hi_char  then id1         = "".
           if sdate      = low_date then sdate       = ?.
           if sdate1     = hi_date  then sdate1      = ?.
/*J3LL*/   if l_effdate  = low_date then l_effdate   = ?.
/*J3LL*/   if l_effdate1 = hi_date  then l_effdate1  = ?.

           
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


           if rdelete then do:
/*G0JC**       update archive with frame a. */
              if archive then do:
/*J2SN** BEGIN DELETE **
 *               filename = string(today,"999999").
 *               filename = "sh" + substring(filename,5,2) +
 *                            substring(filename,1,2)
 *                          + substring(filename,3,2).
 *               filename = filename + ".hst".
 *J2SN** END DELETE **/

/*J2SN*/         filename = "sh"
/*J2SN*/                    + substring(string(year(today),"9999"),3,2)
/*J2SN*/                    + string(month(today),"99")
/*J2SN*/                    + string(day(today),"99")
/*J2SN*/                    + ".hst".
                display filename with frame a.
                {mfmsg.i 51 1}
                /* archive files should be backed up and deleted from disk*/
                if search(filename) <> ? then do:
                   {mfmsg03.i 52 2 filename """" """"}
                   /* WARNING: <filename> exists, data will be appended*/
                end.
                output stream history to value(filename) append.
              end.
/*G0JC*/      else do:
/*G0JC*/        display "" @ filename with frame a.
/*G0JC*/      end.
           end.
           else do:
/*G0JC*/      display "" @ filename with frame a.
/*G0JC*/      if archive then do:
/*G0JC*/         {mfmsg.i 7739 3}
/*G0JC*/         /*GUI UNDO removed */ RETURN ERROR.
/*G0JC*/      end.
           end.

          if shipfrom1   = "" then shipfrom1   = hi_char.
          if id1         = "" then id1         = hi_char.
          if sdate       = ?  then sdate       = low_date.
          if sdate1      = ?  then sdate1      = hi_date.
/*J3LL*/  if l_effdate   = ?  then l_effdate   = low_date.
/*J3LL*/  if l_effdate1  = ?  then l_effdate1  = hi_date.

          /* SELECT PRINTER */
          
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



          {mfphead.i}

/*J3LL** BEGIN DELETE **
 *        for each abs_mstr exclusive-lock
 *         where abs_shipfrom >= shipfrom and abs_shipfrom <= shipfrom1
 *         and   abs_id begins "s"
 *         and   abs_type = "r"
 *         and   substr(abs_id,2,50) >= id and substr(abs_id,2,50) <= id1
 *         and
 *         (
 * /*G0QY   (sel_conf and abs_shp_date >= sdate and abs_shp_date <= sdate1) */
 * /*G0QY        or */
 * /*G0QY        (sel_unconf and abs_shp_date = ?)  */
 * /*G0QY*/     (sel_conf and  substr(abs_status,2,1) = "y" and
 * /*G0QY*/ abs_shp_date >= sdate and abs_shp_date <= sdate1)
 * /*G0QY*/    or
 * /*G0QY*/  (sel_unconf and substr(abs_status,2,1) = "" )
 *         ):
 *J3LL** END DELETE **/

/*J3LL*/  for each abs_mstr exclusive-lock
/*J3LL*/     where abs_shipfrom >= shipfrom and abs_shipfrom <= shipfrom1
/*J3LL*/       and abs_id begins "s"
/*J3LL*/       and abs_type = "r"
/*J3LL*/       and substring(abs_id,2,50) >= id
/*J3LL*/       and substring(abs_id,2,50) <= id1
/*J3LL*/       and abs_shp_date >= sdate and abs_shp_date <= sdate1
/*J3LL*/       and (
/*J3LL*/           (sel_conf and right-trim(substring(abs_status,2,1)) = "y" and
/*J3LL*/            ((abs_eff_date >= l_effdate and abs_eff_date <= l_effdate1)
/*J3LL*/             or (abs_eff_date = ?        and
/*J3LL*/                 l_effdate    = low_date and
/*J3LL*/                 l_effdate1   = hi_date)))
/*J3LL*/         or
/*J3LL*/           (sel_unconf and right-trim(substring(abs_status,2,1)) = "")
/*J3LL*/         ):

             find si_mstr where si_site = abs_shipto no-lock.
             find ad_mstr where ad_addr = abs_shipfrom no-lock no-error.

             assign
                disp_abs_id = substr(abs_id,2,50).

             display
                abs_shipfrom
                disp_abs_id @ abs_id
                ad_name      when (available ad_mstr)
                ad_line1     when (available ad_mstr)
                with frame a1 STREAM-IO /*GUI*/ .

             display
                abs_shipto
                si_desc
                with frame b STREAM-IO /*GUI*/ .

             put skip(1).

             {gprun.i ""rsscdela.p"" "(input recid(abs_mstr), input 0)"}
          end.

          output stream history close.
          
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

       end.

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" shipfrom shipfrom1 id id1 sdate sdate1  l_effdate  l_effdate1 sel_conf sel_unconf rdelete  archive "} /*Drive the Report*/
